/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { useState, useEffect } from "react";
import { Chart, Geom, Axis, Tooltip, Legend } from "bizcharts";
// 将echarts作为一个图表

const Echarts = props => {
  const { data } = props;
  useEffect(() => {}, []);
  const cols = {
    value: { min: 0 },
    time: { range: [0, 1] },
  };

  return (
    <Chart width={400} height={400} data={data.list || []} scale={cols} forceFit>
      <Axis dataKey="time" />
      <Axis dataKey="value" />
      <Legend />
      <Tooltip crosshairs={{ type: "y" }} />
      <Geom type="line" position="time*value" size={2} color="type" />
      <Geom
        type="point"
        position="time*value"
        size={4}
        shape={"circle"}
        style={{ stroke: "#fff", lineWidth: 1 }}
        color="type"
      />
    </Chart>
  );
};

export default Echarts;
